package com.foomia.truego.parsers.json;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.foomia.truego.types.Group;
import com.foomia.truego.types.TruegoType;



public abstract class AbstractParser <T extends TruegoType> implements Parser<T>{
	 /** 
     * All derived parsers must implement parsing a JSONObject instance of themselves. 
     */
    public abstract T parse(JSONObject json) throws JSONException;
    
    /**
     * Only the GroupParser needs to implement this.
     */
    public Group parse(JSONArray array) throws JSONException {
        throw new JSONException("Unexpected JSONArray parse type encountered.");
    }

}
